package com.ets.cert.model;

import com.ets.cert.model.BaseObject;

import org.compass.annotations.Searchable;
import org.compass.annotations.SearchableComponent;
import org.compass.annotations.SearchableId;
import org.compass.annotations.SearchableProperty;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;

import javax.xml.bind.annotation.XmlRootElement;

import java.io.Serializable;

@Entity
@Table(name="cert",catalog="cert")
@Searchable
@XmlRootElement
public class Cert extends BaseObject implements Serializable {
    private Long id;
    private Long categoryId;
    private String introduce;
    private String name;
    private String process;

    @Id @GeneratedValue(strategy=IDENTITY) @SearchableId    
    public Long getId() {
        return this.id;
    }
    
    public void setId(Long id) {
        this.id = id;
    }
    
    @Column(name="category_id")
    @SearchableProperty
    public Long getCategoryId() {
        return this.categoryId;
    }
    
    public void setCategoryId(Long categoryId) {
        this.categoryId = categoryId;
    }
    
    @Column(name="introduce")
    @SearchableProperty
    public String getIntroduce() {
        return this.introduce;
    }
    
    public void setIntroduce(String introduce) {
        this.introduce = introduce;
    }
    
    @Column(name="name", length=50)
    @SearchableProperty
    public String getName() {
        return this.name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    @Column(name="process")
    @SearchableProperty
    public String getProcess() {
        return this.process;
    }
    
    public void setProcess(String process) {
        this.process = process;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Cert pojo = (Cert) o;

        if (categoryId != null ? !categoryId.equals(pojo.categoryId) : pojo.categoryId != null) return false;
        if (introduce != null ? !introduce.equals(pojo.introduce) : pojo.introduce != null) return false;
        if (name != null ? !name.equals(pojo.name) : pojo.name != null) return false;
        if (process != null ? !process.equals(pojo.process) : pojo.process != null) return false;

        return true;
    }

    public int hashCode() {
        int result = 0;
        result = (categoryId != null ? categoryId.hashCode() : 0);
        result = 31 * result + (introduce != null ? introduce.hashCode() : 0);
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (process != null ? process.hashCode() : 0);

        return result;
    }

    public String toString() {
        StringBuffer sb = new StringBuffer(getClass().getSimpleName());

        sb.append(" [");
        sb.append("id").append("='").append(getId()).append("', ");
        sb.append("categoryId").append("='").append(getCategoryId()).append("', ");
        sb.append("introduce").append("='").append(getIntroduce()).append("', ");
        sb.append("name").append("='").append(getName()).append("', ");
        sb.append("process").append("='").append(getProcess()).append("'");
        sb.append("]");
      
        return sb.toString();
    }

}
